﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EBAYVN.DOMAIN;
namespace EBAYVN.DAO
{
    public class NhomTinhNangDao
    {
        private readonly EBAYVNDOMAINDataContext db;
        public NhomTinhNangDao()
        {
            db = new EBAYVNDOMAINDataContext();
        }
        public List<NHOMTINHNANG> GetList()
        {
            return db.NHOMTINHNANGs.Where(p=>p.ISSHOW.HasValue && p.ISSHOW.Value ).OrderBy(p => p.TENNHOMTN).ToList();
        }
        public List<NHOMTINHNANG> GetListByLoaiSanPham(String maloaisp)
        {
            return db.NHOMTINHNANGs.Where(p =>p.ISSHOW.HasValue && p.ISSHOW.Value && p.MALOAISANPHAM.Equals(maloaisp)).OrderBy(p => p.TENNHOMTN).ToList();
        }
        public List<NHOMTINHNANG> Get(String maloaisanpham, string matab)
        {
            return db.NHOMTINHNANGs.Where(p => p.MALOAISANPHAM.Equals(maloaisanpham) && p.MATAB.Equals(matab)).ToList();
        }
    }
}
